package cn.iocoder.yudao.module.crm.dal.mysql.customerbill;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.crm.dal.dataobject.customerbill.CustomerBillDO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.crm.controller.admin.customerbill.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 客户账单 Mapper
 *
 * @author nail.zhang
 */
@Mapper
public interface CustomerBillMapper extends BaseMapperX<CustomerBillDO> {

    default PageResult<CustomerBillDO> selectPage(CustomerBillPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CustomerBillDO>()
                .eqIfPresent(CustomerBillDO::getCustomerId, reqVO.getCustomerId())
                .betweenIfPresent(CustomerBillDO::getBillDate, reqVO.getBillDate())
                .eqIfPresent(CustomerBillDO::getRemark, reqVO.getRemark())
                .eqIfPresent(CustomerBillDO::getOrderNo, reqVO.getOrderNo())
                .likeIfPresent(CustomerBillDO::getCompanyName, reqVO.getCompanyName())
                .betweenIfPresent(CustomerBillDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(CustomerBillDO::getCompanyCode, reqVO.getCompanyCode())
                .eqIfPresent(CustomerBillDO::getContainerType, reqVO.getContainerType())
                .eqIfPresent(CustomerBillDO::getBillStatus, reqVO.getBillStatus())
                .betweenIfPresent(CustomerBillDO::getPayTime, reqVO.getPayTime())
                .orderByDesc(CustomerBillDO::getId));
    }

    List<CustomerBillExportVO> selectBillList(CustomerBillPageReqVO reqVO);


    Page<CustomerBillRespVO> selectBillPageList(Page page, @Param("param") CustomerBillPageReqVO reqVO);

}
